<?php
require(dirname(__FILE__)."/includes/init.php");
if(isset($_SESSION['user_name'])){
if(isset($_REQUEST['id'])){
	$id = $_REQUEST['id'];
	if(isset($_REQUEST['act'])){
		if($_REQUEST['act']=='del'){
			$sql = "delete from num where id = $id";
			$GLOBALS['db']->dbquery($sql);
			exit('Del Success!');
		}
	}
	if(!is_numeric($id)) {exit("asdf");}
}else{
	exit('abc');
}
if(isset($_REQUEST['Submit'])){
	$str='';
	$num = $_REQUEST['num'];
	$temp = $_REQUEST['temp'];
	$templateId = $_REQUEST['templateId'];
	$emailNumType= $_REQUEST['emailNumType'];
	$flag = $_REQUEST['flag'];
	if(!empty($num) || $num==0){
		$str .= "num='".$num."',";
	}
	if(!empty($temp) || $temp==0){
		$str .= "temp='".$temp."',";
	}
	if(!empty($sendServer) || $sendServer == 0){
		$str .= "templateId='".$templateId."',";
	}
	if(!empty($flag) || $flag == 0){
		$str .= "flag='".$flag."',";
	}
	$str = trim($str,",");
	$sql = "update num set ".$str." where id = ".$id."";
	$GLOBALS['db']->dbquery($sql);
}

$sql = "select * from num where id = ".$id."";
$result = $GLOBALS['db']->dbGetRow($sql);

?>
<table width="900" border="0" bgcolor="#0066FF">
  <tr bgcolor="#FFFFFF">
    <td>编号</td>
    <td>发送数量</td>
    <td>TempCache</td>
    <td>模板ID</td>
    <td>TYPE</td>
    <td>标识</td>
    <td>添加时间</td>
  </tr>
<form action="" name="edit" method="post">  
  <tr bgcolor="#FFFFFF">
    <td><?php echo $result['id']; ?></td>
    <td><input name="num" type="text" value="<?php echo $result['num'];?>"/></td>
    <td><input name="temp" type="text" value="<?php echo $result['temp'];?>" id="temp" /></td>
    <td><input name="templateId" type="text" value="<?php echo $result['templateId'];?>" size="10" maxlength="10"/></td>
    <td><input name="emailNumType" type="text" value="<?php echo $result['emailNumType'];?>" size="2" maxlength="2"/></td>
    <td><input name="flag" type="text" value="<?php echo $result['flag'];?>" size="10" maxlength="10"/></td>
    <td><?php echo date("Y-m-d H:i:s",$result['timeStamps']); ?></td>
    </tr> 

  <tr bgcolor="#FFFFFF">
    <td>&nbsp;</td>
    <td colspan="4"><input name="id" type="hidden" value="<?php echo $result['id'];?>" /><input type="submit" name="Submit" value="提交" /></td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    </tr>
</form>
  <tr bgcolor="#FFFFFF">
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
</table>
<?php
}else{
	echo "hello";
}
?>